package com.oocl.CRM;

import java.util.Scanner;

import com.oocl.Bean.Customer;
import com.oocl.Model.LinkedList;
import com.oocl.Services.ListServices;
import com.oocl.Util.CmdParser;


public class App 
{
    public static void main( String[] args )
    {
    	ListServices listServices = new ListServices();
    	
    	listServices.initial();
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNext()){
        	String string = scanner.nextLine();
        	String operate = CmdParser.parseOperate(string);
        	String param = CmdParser.parseParam(string);;
        	switch (operate) {
			case "L":
				listServices.look(param);
				break;
			case "A":
				listServices.add(param);
				break;
			case "D":
				listServices.delete(param);
				break;
			case "U":
				listServices.modify(param);
				break;
			case "O":
				LinkedList<Customer> sorted = listServices.sort(param);
				listServices.printSorted(sorted);
				break;
			case "H":
				listServices.help(param);
				break;
			case "Q":
				System.exit(0);
				break;
			default:
				break;
			}
        }
        scanner.close();
    }
}
